<template>
  <div class="content">
    <BreadNav
      :location="location"
      :routers="routers"
      @getData="getData"
    />
    <PicsList
      v-if="!showDetail"
      @getData="getData"
    />
    <ImageContent v-if="showDetail" />
    <Footer />
  </div>
</template>

<script>
import BreadNav from '@/components/BreadNav.vue'
import Footer from '@/components/Footer.vue'
import ImageContent from '@/components/ImageContent.vue'
import PicsList from '@/components/PicsList.vue'
import bus from '@/main'
export default {
  components: {
    BreadNav,
    Footer,
    ImageContent,
    PicsList
  },
  data() {
    return {
      location: '我的相册',
      routers: 'wodexiangce',
      showDetail: false
    }
  },
  created() {
    this.getData()
  },
  mounted() {
    bus.$on('getData', this.getData)
  },
  methods: {
    getData() {
      console.log(11111)
      if (this.$route.query.id) {
        this.showDetail = true
      } else {
        this.showDetail = false
      }
    }
  }
}
</script>

<style lang="scss" scoped>
// 宽度大于1201px时
@media screen and (min-width: 1201px) {
  .content {
    width: 1200px;
    margin: 0 auto;
  }
}

// 宽度小于1200px时
@media screen and (max-width: 1200px) {
  .content {
    margin: 0 40px;
  }
}

@media only screen and (max-width: 480px) {
  .content {
    margin: 0 15px;
  }
}
</style>
